﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using DataAccessClasses;


namespace BUSINESS_OBJECT
{
    public class SCHEDULEe
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _SC_ID = -99;
        private string _SC_TYPE = "";
        private string _SC_DESCRIPTION = "";
        private DateTime _DATE =Convert.ToDateTime( "1/1/1800");
        private bool _ISDELETED = false;

        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public long SC_ID
        {
            get
            {
                return _SC_ID;
            }
            set
            {
                _SC_ID = value;
            }
        }

        public string SC_TYPE
        {
            get
            {
                return _SC_TYPE;
            }
            set
            {
                _SC_TYPE = value;
            }
        }
        public string SC_DESCRIPTION
        {
            get
            {
                return _SC_DESCRIPTION;
            }
            set
            {
                _SC_DESCRIPTION = value;
            }
        }
        public DateTime DATE
        {
            get
            {
                return _DATE;
            }
            set
            {
                _DATE = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@SC_ID", SC_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@SC_TYPE", SC_TYPE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@SC_DESCRIPTION", SC_DESCRIPTION, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@DATE", DATE, DbType.DateTime, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4 };
                return DAC.Save("SCHEDULE_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long SC_ID, string SC_TYPE, string SC_DESCRIPTION, DateTime DATE, bool ISDELETED, string PARAANDOR)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@SC_ID", SC_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@SC_TYPE", SC_TYPE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@SC_DESCRIPTION", SC_DESCRIPTION, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@DATE", DATE, DbType.DateTime, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@PARAANDOR", PARAANDOR, DbType.AnsiString, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                DataTable dt1 = DAC.Select("SCHEDULE_GET", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}
